---
title: "Get All TCGA Rna-Seq Data"
output: html_document
date: '2023-02-24'
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

```{r}
library(TCGAbiolinks)
library(SummarizedExperiment)
```
```{r}
projects<-c("ACC","BLCA","BRCA","CESC","CHOL","COAD","DLBC","ESCA","HNSC","KICH","KIRC","KIRP","LGG","LIHC","LUAD","LUSC","MESO","OV","PAAD","PCPG","PRAD","READ","SARC","SKCM","STAD","TGCT","THCA","THYM","UCEC","UCS","UVM","LAML","GBM")
project_files <- c("acc.rda","blca.rda","brca.rda","cesc.rda","chol.rda","coad.rda","dlbc.rda","esca.rda","hnsc.rda","kich.rda","kirc.rda","kirp.rda","lgg.rda","lihc.rda","luad.rda","lusc.rda","meso.rda","ov.rda","paad.rda","pcpg.rda","prad.rda","read.rda","sarc.rda","skcm.rda","stad.rda","tgct.rda","thca.rda","thym.rda","ucec.rda","ucs.rda","uvm.rda","laml.rda","gbm.rda")

projects<-c("ACC")
project_files <- c("acc.rda")

cnt =length(projects)
for(val in 1:cnt){
  project_name <- projects[val]
  project_file <- project_files[val]
  projectTCGA <- paste0("TCGA-",project_name)
query <- GDCquery(project = projectTCGA,
                              data.category = "Transcriptome Profiling",
                              data.type = "Gene Expression Quantification",
                              workflow.type = "STAR - Counts")
GDCdownload(query, method="api")
project_name <- GDCprepare(query = query, summarizedExperiment = TRUE)
save(project_name,file=project_file)
rm(project_name)
}
```